package com.lzxr.test.servlet;

import com.lzxr.test.entity.R;
import com.lzxr.test.entity.UriView;
import com.lzxr.test.service.UriService;
import com.lzxr.test.service.impl.UriServiceImpl;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public class UriViewServlet extends HttpServlet {
    private UriService uriService = new UriServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<UriView> ret = uriService.getList();

        R data = R.ok("获取成功");
        data.setData(ret);

        resp.setContentType("application/json;charset=utf-8;");
        resp.getWriter().print(data);
    }

}
